package com.demo.blog;

import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;

public class SystemController extends Controller{

	public void queryBottom() {
		 Integer page = getInt("page");
		 Integer limit = getInt("limit");
		 String title = get("title");
//		 Integer city = getInt("city");

		String sql = "select * from thebottomlink ";
		String whereSql =" WHERE 1=1 ";
		if(title != null) {
			whereSql +=" and ljName like '%"+title+"%'";
		}
//		if(city != null && city != -1) {
//			whereSql += " and level = '"+city+"' ";
//		}
		String count = "select count(1) from thebottomlink";
		count += whereSql;// 很绕
		sql += whereSql;
		sql += " LIMIT ?,?";
		set("data", Db.find(sql ,(page-1)*10, limit));
		set("code", 0);
		set("count", Db.query(count));
		renderJson();
	}
}
